<extend name="Base/common"/>
<block name="body">
    <body style="background: #fef580;">
    <div class="container">
        <img src="__IMG__/share_01.png" width="100%"/>
        <div class="share_list">
            <div class="share_bg_box">
                <img src="__IMG__/share_02.png" width="100%"/>
                <span class="share_yen">&yen;</span>
                <span class="share_price">{$couponData['money']}</span>
            </div>
        </div>
        
        <if condition="$count egt $couponData['person_limit']">
        	<div class="share_label" id="T-bag" style="display: block;">代金券已放入账户！快去使用吧~</div>
        	<p class="share_sub" id="ajre"><a href="{:U('Index/index')}" class="share_use">去使用</a></p>
        <else/>
        	<div class="share_label" id="T-bag" style="display: none;">代金券已放入账户！快去使用吧~</div>
        	<p class="share_sub" id="ajre"><a href="javascript:ajax(0)" class="share_use">领取</a></p>
        </if>
    </div>
    <script type="text/javascript">
    	function ajax(){
                var url="{:U('Coupon/receive')}";
                var cid="{$cid}";
                $.ajax({
                    url:url,
                    type:"POST",
                    data:{'cid':cid},
                    success:function(backObj){
                        if(backObj.state==0){
                            $("#T-bag").css("display","block");
                            var html='<a href="{:U(\'Index/index\')}" class="share_use">去使用</a>';
                            $("#ajre").html(html);
                            alert(backObj.msg);
                        }else if(backObj.state==1){alert(backObj.msg);}
                    },
                })
            }
    </script>
    </body>
</block>
<!--<script src="__STATIC__/jquery-1.10.2.min.js"></script>-->
